package com.htthorizon.powersupply.service.impl;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.htthorizon.powersupply.domain.TgLoadMonitor;
import com.htthorizon.powersupply.service.TgLoadMonitorService;
import com.htthorizon.powersupply.mapper.TgLoadMonitorMapper;
import com.htthorizon.powersupply.utils.OrgUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Brilliant
* @description 针对表【tg_load_monitor】的数据库操作Service实现
* @createDate 2025-01-16 17:34:58
*/
@Service
public class TgLoadMonitorServiceImpl extends ServiceImpl<TgLoadMonitorMapper, TgLoadMonitor>
    implements TgLoadMonitorService{

    @Override
    public List<TgLoadMonitor> getRealTimeLoad(String dataDt,int time,String tgType,String loadType) {
        List<TgLoadMonitor> realTimeLoad = baseMapper.getRealTimeLoad(dataDt, time, tgType, loadType);
        if(CollectionUtils.isNotEmpty(realTimeLoad)){
            realTimeLoad.forEach(tgLoadMonitor -> {
                tgLoadMonitor.setStdOrgNm(OrgUtil.getStdOrgNm(tgLoadMonitor.getStdOrgNm()));
            });
        }
        return realTimeLoad;
    }
}




